# from question_generator import QuestionGenerator
# import os

# def main():
#     # 初始化题目生成器
#     try:
#         generator = QuestionGenerator()
#         print("题目生成器初始化成功！")
#     except Exception as e:
#         print(f"初始化失败：{str(e)}")
#         return

#     while True:
#         print("\n请选择功能：")
#         print("1. 基础对话")
#         print("2. 处理文档生成题目")
#         print("3. 生成特定类型题目")
#         print("4. 清空历史记录")
#         print("5. 退出")
        
#         choice = input("请输入选项（1-5）：")
        
#         if choice == "1":
#             message = input("请输入您的问题：")
#             response = generator.chat(message)
#             print("\n回答：")
#             print(response)
            
#         elif choice == "2":
#             file_path = input("请输入文档路径：")
#             if not os.path.exists(file_path):
#                 print("文件不存在！")
#                 continue
#             response = generator.process_document(file_path)
#             print("\n生成的题目：")
#             print(response)
            
#         elif choice == "3":
#             print("\n请选择题目类型：")
#             print("1. 选择题")
#             print("2. 填空题")
#             print("3. 简答题")
#             print("4. 论述题")
#             print("5. 混合类型")
            
#             type_choice = input("请输入选项（1-5）：")
#             question_types = {
#                 "1": "选择题",
#                 "2": "填空题",
#                 "3": "简答题",
#                 "4": "论述题",
#                 "5": None
#             }
            
#             count = input("请输入题目数量（默认5道）：")
#             try:
#                 count = int(count) if count else 5
#             except ValueError:
#                 count = 5
                
#             difficulty = input("请输入难度（简单/中等/困难，默认中等）：")
#             if difficulty not in ["简单", "中等", "困难"]:
#                 difficulty = "中等"
                
#             response = generator.generate_questions(
#                 question_type=question_types.get(type_choice),
#                 count=count,
#                 difficulty=difficulty
#             )
#             print("\n生成的题目：")
#             print(response)
            
#         elif choice == "4":
#             generator.clear_history()
#             print("历史记录已清空！")
            
#         elif choice == "5":
#             print("感谢使用，再见！")
#             break
            
#         else:
#             print("无效的选项，请重新选择！")

# if __name__ == "__main__":
#     main() 